<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>异步更新队列</title>
</head>
<body>
<div id="demo">
    {{msg}}
</div>
<script src="../js/libs/vue.js"></script>
<script>
    var vm = new Vue({
        el: '#demo',
        data: {
            msg: 'Hello'
        }
    });
    vm.msg = 'new Message';//修改数据
    console.log(vm.$el.textContent === 'new Message');//false
    Vue.nextTick(function () {
        console.log(vm.$el.textContent === 'new Message');
    });
    Vue.component('example', {
        template: '<span>{{msg}}</span>',
        data: function () {
            return {
                msg: 'not updated'
            }
        },
        methods: {
            updateMessage: function () {
                this.msg = 'updated';
                console.log(this.$el.textContent);
                this.$nextTick(function () {
                    console.log(this.$el.textContent);
                })
            }
        }
    });
</script>
</body>
</html>